<script>
//1.引入子组件
import MyNav from '@/components/MyNav.vue'
export default {
  name: "MyMain",
  data(){
    return {
      value: 1000 ,
      item: -1,
    }
  },
  /*2.注册子组件*/
  components:{
    MyNav
  },
  methods:{
    /*获取子组件传递的值的函数*/
    getItem(index){
      this.item = index;
    }
  }
}
</script>

<template>
  <div>
    <h3>我是父组件</h3>
<!--3.使用子组件    -->
    <MyNav  :abc="value" @myEvent="getItem"  />
    <div>获取到的子组件中的值为:{{item}}</div>
  </div>
</template>

<style scoped>
  h3{
    color: yellowgreen;
  }
</style>